# directory
from __future__ import annotations

# 数据存储目录配置
DATA_SAVE_DIR = "datasets"          # 原始数据存储目录
TRAINED_MODEL_DIR = "trained_models" # 训练好的模型存储目录
TENSORBOARD_LOG_DIR = "tensorboard_log" # TensorBoard日志目录
RESULTS_DIR = "results"             # 实验结果存储目录

# date format: '%Y-%m-%d'
# 训练、测试、交易时间配置
TRAIN_START_DATE = "2020-01-06"  # bug fix: set Monday right, start date set 2014-01-01 ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 0, the array at index 0 has size 1658 and the array at index 1 has size 1657
TRAIN_END_DATE = "2024-01-31"    # 训练结束日期

TEST_START_DATE = "2024-02-01"   # 测试开始日期
TEST_END_DATE = "2025-04-01"     # 测试结束日期

TRADE_START_DATE = "2024-11-01"  # 交易开始日期
TRADE_END_DATE = "2025-07-01"    # 交易结束日期

# stockstats technical indicator column names
# check https://pypi.org/project/stockstats/ for different names
# 技术指标列表配置
INDICATORS = [
    "macd",         # MACD指标
    "boll_ub",      # 布林带上轨
    "boll_lb",      # 布林带下轨
    "rsi_30",       # 30日相对强弱指数
    "cci_30",       # 30日商品通道指数
    "dx_30",        # 30日方向运动指数
    "close_30_sma", # 30日收盘价简单移动平均线
    "close_60_sma", # 60日收盘价简单移动平均线
]

LIHUA_INDICATORS = [
    "macd",         # MACD指标
    "boll_ub",      # 布林带上轨
    "boll_lb",      # 布林带下轨
    "rsi_30",       # 30日相对强弱指数
    "cci_30",       # 30日商品通道指数
    "dx_30",        # 30日方向运动指数
    "ma_price_7",
    "ma_price_13",
    "ma_price_30",
    "ma_price_60",
    "ma_price_90",
    "ma_price_180",
    "ma_price_300",

    "ma_price_7",
    "ma_price_13",
    "ma_price_30",
    "ma_price_60",
    "ma_price_90",
    "ma_price_180",
    "ma_price_300",

    "slope_price_7",
    "slope_price_13",
    "slope_price_30",
    "slope_price_60",
    "slope_price_90",
    "slope_price_180",
    "slope_price_300",

    "ma_volume_7",
    "ma_volume_13",
    "ma_volume_30",
    "ma_volume_60",
    "ma_volume_90",
    "ma_volume_180",
    "ma_volume_300",

    "slope_volume_7",
    "slope_volume_13",
    "slope_volume_30",
    "slope_volume_60",
    "slope_volume_90",
    "slope_volume_180",
    "slope_volume_300",
]
# Model Parameters
# 各种强化学习模型参数配置
A2C_PARAMS = {"n_steps": 5, "ent_coef": 0.01, "learning_rate": 0.0007}  # A2C算法参数
PPO_PARAMS = {
    "n_steps": 2048,        # 每次更新的步数
    "ent_coef": 0.01,       # 熵系数
    "learning_rate": 0.00025, # 学习率
    "batch_size": 64,       # 批处理大小
}  # PPO算法参数
DDPG_PARAMS = {"batch_size": 128, "buffer_size": 50000, "learning_rate": 0.001}  # DDPG算法参数
TD3_PARAMS = {"batch_size": 100, "buffer_size": 1000000, "learning_rate": 0.001} # TD3算法参数
SAC_PARAMS = {
    "batch_size": 64,       # 批处理大小
    "buffer_size": 100000,  # 经验回放缓冲区大小
    "learning_rate": 0.0001, # 学习率
    "learning_starts": 100, # 开始学习前的步数
    "ent_coef": "auto_0.1", # 熵系数
}  # SAC算法参数
ERL_PARAMS = {
    "learning_rate": 3e-5,   # 学习率
    "batch_size": 2048,      # 批处理大小
    "gamma": 0.985,          # 折扣因子
    "seed": 112,             # 随机种子
    "net_dimension": 512,    # 网络维度
    "target_step": 5000,     # 目标步数
    "eval_gap": 30,          # 评估间隔
    "eval_times": 64,  # bug fix:KeyError: 'eval_times' line 68, in get_model model.eval_times = model_kwargs["eval_times"]
}  # ERL算法参数
RLlib_PARAMS = {"lr": 5e-5, "train_batch_size": 500, "gamma": 0.99}  # RLlib参数


# Possible time zones
# 时区配置
TIME_ZONE_SHANGHAI = "Asia/Shanghai"  # 中国时区（上海）- 恒生指数HSI, 上交所SSE, 中证指数CSI
TIME_ZONE_USEASTERN = "US/Eastern"  # 美国东部时区 - 道琼斯指数, 纳斯达克指数, 标普500指数
TIME_ZONE_PARIS = "Europe/Paris"  # 巴黎时区 - CAC指数
TIME_ZONE_BERLIN = "Europe/Berlin"  # 柏林时区 - DAX, TECDAX, MDAX, SDAX指数
TIME_ZONE_JAKARTA = "Asia/Jakarta"  # 雅加达时区 - LQ45指数
TIME_ZONE_SELFDEFINED = "xxx"  # 如果以上时区都不符合需求，可以自定义时区
USE_TIME_ZONE_SELFDEFINED = 0  # 0 (默认) 或 1 (使用自定义时区)

# parameters for data sources
# 数据源API密钥配置
ALPACA_API_KEY = "xxx"  # 你的ALPACA_API_KEY
ALPACA_API_SECRET = "xxx"  # 你的ALPACA_API_SECRET
ALPACA_API_BASE_URL = "https://paper-api.alpaca.markets"  # alpaca url
BINANCE_BASE_URL = "https://data.binance.vision/"  # binance url